package com.pronhub.luowowo.util;

import lombok.Getter;

@Getter
public enum  Rediskey {
    //海内外推荐的攻略
    STRATEGY_ZSET_SORT_COMMEND("strategy_zset_sort_commend",-1L),
    //热门地点攻略排行操作
    STRATEGY_ZSET_SORT_HOT("strategy_zset_sort_hot",-1L),
    //vo的id 用户数和点赞数的用法
    STRATEGY_STATIS_VO("strategy_statis_vo",-1L),
    //收藏文章的
    STRATEGY_STATIS_FAVOR("strategy_statis_favor",-1L),
    //文章点赞的
    STRATEGY_STATIS_THUMBSUPNUM("STRATEGY_STATIS_THUMBSUPNUM",-1L),

    //手机验证码
    VERIFY_CODE("verify_code",Consts.VERIFY_CODE_VAI_TIME *60L),
    //用户登录
    USER_LOGIN("user_login",Consts.USER_INFO_TOKEN_VAI_TIME*60L);

    private String prefix;
    private Long time;
    private Rediskey(String prefix,Long time){
        this.prefix = prefix;
        this.time = time;
    }
    //自己拼接字符串
    public String getKey(String data){
        StringBuilder builder = new StringBuilder(30);
        String key = builder.append(prefix).append(":").append(data).toString();
        return key;
    }
    public String getKeys(String ... values){
        StringBuilder builder = new StringBuilder(30);
        builder.append(prefix);
        for (String value : values) {
            builder.append(":").append(value);
        }
        return builder.toString();
    }
}
